package com.cmpe451.nutty.dao;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import com.cmpe451.nutty.model.Tools;

/**
 * Recipe dao contains the database access elements for recipes.
 * @author CmpE Group 2 Fall 2014 nuttyconfirmation@gmail.com
 *
 */
@Repository
public class ToolsDaoImpl extends BaseDaoImpl implements ToolsDao, BaseDao{

	@Override
	public Tools findToolById(Long toolID) {
		return getHibernateTemplate().get(Tools.class, toolID);
	}

	@Override
	public Tools findToolByName(String toolName) {
		Criteria criteria = createCriteria(Tools.class);
		criteria.add(Restrictions.eq("tool_name", toolName));
		return (Tools) criteria.uniqueResult();
	}
	
}
